<template>
	<view class="trainer-detail-container">
		<!-- 顶部背景图 -->
		<view>
			<image class="top-bg-img" src="/static/trainer_s.png" mode="aspectFill" />
		</view>

		<!-- 教练信息卡片 -->
		<view class="coach-info-card">
			<view class="coach-name-row">
				<text class="coach-name">{{ coach.name }}</text>
				<view>
					<image class="tag-icon" src="/static/trainer_z.png" />
				</view>
			</view>
			<view class="coach-desc">{{ coach.description }}</view>
		</view>

		<!-- 个人信息 -->
		<view class="section-title">个人信息</view>
		<view class="avatar-wrap">
			<image class="coach-avatar" :src="$xyfun.image(coach.avatar)" mode="aspectFill" />
		</view>
	</view>
</template>


<script>
	export default {
		data() {
			return {
				coachId: 0,
				coach: {}
			};
		},
		onLoad(options) {
			if (options.id) {
				this.coachId = options.id;
				this.loadCoachDetail();
			}
		},
		methods: {
			loadCoachDetail() {
				this.$api.post({
					url: '/private_session/coachDetail',
					data: {
						id: this.coachId
					},
					success: res => {
						this.coach = res || {};
					}
				});
			},
			goBack() {
				uni.navigateBack();
			}
		}
	};
</script>


<style lang="scss" scoped>
	.trainer-detail-container {
		background: #f8f8f8;
		min-height: 100vh;
		padding-bottom: 40rpx;
	}

	.top-bg-img {
		width: 100vw;
		height: 540rpx;
		display: block;
		border-bottom-left-radius: 32rpx;
		border-bottom-right-radius: 32rpx;
	}

	.coach-info-card {
		background: #F4F4F4;
		border-radius: 20rpx;
		margin: -40rpx 0rpx 24rpx 0rpx;
		box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.06);
		padding: 32rpx 34rpx 18rpx 34rpx;
		position: relative;
		z-index: 1;

		.coach-name-row {
			display: flex;
			align-items: center;
			margin-bottom: 12rpx;

			.coach-name {
				font-size: 32rpx;
				font-weight: bold;
				color: #222;
				margin-right: 18rpx;
			}

			.tag-icon {
				width: 140rpx;
				height: 40rpx;
			}
		}

		.coach-desc {
			font-size: 26rpx;
			color: #222;
		}
	}

	.section-title {
		font-size: 35rpx;
		font-weight: bold;
		color: #222;
		margin: 32rpx 0 18rpx 32rpx;
	}

	.avatar-wrap {
		display: flex;
		justify-content: center;
		align-items: center;
		margin-bottom: 32rpx;

		.coach-avatar {
			width: 400rpx;
			height: 400rpx;
			border-radius: 50%;
			object-fit: cover;
			background: #fff;
			box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.06);
		}
	}
</style>